package com.example.springbootrabbitmq.demo3exchangetopic;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "topic.message2")
public class TopicMessage2Receiver {

    /*
    这里能获取channel
    如果队列的autoDelete=false
    则需要channel.basicAck(deliveryTag,true);进行确认后该消息才会从队列中删除。
     */
    @RabbitHandler
    public void process(String msg,Channel channel) {
        System.out.println("topicMessage2Receiver: " + msg);
    }

}
